@echo off
SET PROJNAME=%1
SET TEMPLATEDIR=template

mkdir "%PROJNAME%"
mkdir "%PROJNAME%\Components"
mkdir "%PROJNAME%\Contents"
mkdir "%PROJNAME%\Entities"
mkdir "%PROJNAME%\Helpers"
mkdir "%PROJNAME%\Managers"
mkdir "%PROJNAME%\Scenes"
mkdir "%PROJNAME%\Utils"

REM create1

REM copy %TEMPLATEDIR%\beforebuild.bat.txt  %PROJNAME%\beforebuild.bat  /Y
copy %TEMPLATEDIR%\GlobalUsings.cs.txt  %PROJNAME%\GlobalUsings.cs /Y
copy %TEMPLATEDIR%\template.csproj.txt  %PROJNAME%\%PROJNAME%.csproj /Y

REM create2

echo+ using %PROJNAME%; >> %PROJNAME%\Program.cs
echo+  >> %PROJNAME%\Program.cs
echo+ using var game = new MainGame(); >> %PROJNAME%\Program.cs
echo+ game.Run(); >> %PROJNAME%\Program.cs

REM create3

echo+ using %PROJNAME%.Scenes; >> %PROJNAME%\MainGame.cs
echo+  >> %PROJNAME%\MainGame.cs
echo+ namespace %PROJNAME%; >> %PROJNAME%\MainGame.cs
echo+ public class MainGame : Core >> %PROJNAME%\MainGame.cs
echo+ { >> %PROJNAME%\MainGame.cs
echo+     public MainGame():base() >> %PROJNAME%\MainGame.cs
echo+     { >> %PROJNAME%\MainGame.cs
echo+     } >> %PROJNAME%\MainGame.cs
echo+  >> %PROJNAME%\MainGame.cs
echo+     protected override void Initialize() >> %PROJNAME%\MainGame.cs
echo+     { >> %PROJNAME%\MainGame.cs
echo+         base.Initialize(); >> %PROJNAME%\MainGame.cs
echo+         Scene = new MainScene(); >> %PROJNAME%\MainGame.cs
echo+     } >> %PROJNAME%\MainGame.cs
echo+ } >> %PROJNAME%\MainGame.cs

REM create4

echo+ namespace %PROJNAME%.Scenes; >> %PROJNAME%\Scenes\MainScene.cs
echo+  >> %PROJNAME%\Scenes\MainScene.cs
echo+ public class MainScene : Scene >> %PROJNAME%\Scenes\MainScene.cs
echo+ { >> %PROJNAME%\Scenes\MainScene.cs
echo+     #region lifecycle >> %PROJNAME%\Scenes\MainScene.cs
echo+     public override void Initialize() >> %PROJNAME%\Scenes\MainScene.cs
echo+     { >> %PROJNAME%\Scenes\MainScene.cs
echo+         base.Initialize(); >> %PROJNAME%\Scenes\MainScene.cs
echo+  >> %PROJNAME%\Scenes\MainScene.cs
echo+         var greeter = CreateEntity("greeter") >> %PROJNAME%\Scenes\MainScene.cs
echo+                      .AddComponent(new TextComponent(null, text: "hello, world!", Vector2Ext.Left * 10, Color.White)); >> %PROJNAME%\Scenes\MainScene.cs
echo+  >> %PROJNAME%\Scenes\MainScene.cs
echo+     } >> %PROJNAME%\Scenes\MainScene.cs
echo+     #endregion >> %PROJNAME%\Scenes\MainScene.cs
echo+  >> %PROJNAME%\Scenes\MainScene.cs
echo+ } >> %PROJNAME%\Scenes\MainScene.cs

REM add

dotnet sln add %PROJNAME%\%PROJNAME%.csproj


